package org.wuhong.service.impl;

import com.wuhong.entity.Folder;
import com.wuhong.result.ResultData;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.wuhong.mapper.FolderMapper;
import org.wuhong.service.FolderService;

import java.util.List;
import java.util.Map;

/**
 * @ClassName FolderServiceImpl
 * @Description TODO
 * @Author director吴
 * @Date 2023/4/23 8:46
 * @Version 1.0
 **/
@Service
public class FolderServiceImpl implements FolderService {

    @Autowired
    FolderMapper folderMapper;


    @Override
    public ResultData getAllFolders(Map<String,String> map) {
        ResultData resultData = new ResultData();
        try {
            resultData.setSuccess(true);
            resultData.setData(folderMapper.getAllFolders(map.get("userId"), map.get("parentId")));

        } catch (Exception e) {
            resultData.setSuccess(false);
            resultData.setMsg(e.toString());
            e.printStackTrace();
        }
        return resultData;
    }

    @Override
    public ResultData getAllFoldersChrild(Map<String, String> map) {
        ResultData resultData = new ResultData();

        if (map.containsKey("id")  && StringUtils.isBlank(map.get("id")));
        resultData.setData(folderMapper.getAllFoldersChrild(map.get("id")));

        return resultData;
    }
}
